package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.NursingLevelDto;
import com.zzyl.entity.NursingLevel;
import com.zzyl.vo.NursingLevelVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface NursingLevelMapper {
    Page<NursingLevelVo> selectByPage(Integer pageNum, Integer pageSize, String name, Integer status);

    // 根据名称查询是否有重复
    @Select("select count(*) from nursing_level where name = #{name}")
    int selectCount(String name);

    void insertLevel(NursingLevel nursingLevel);

    @Select("select count(*) from nursing_level where id = #{id}")
    int countById(Long id);

    NursingLevelVo selectById(Long id);

    int deleteById(Long id);

    void updateById(NursingLevel nursingLevel);

    @Update("update nursing_level set status = (1 - status) where id = #{id}")
    void alterStatus(Long id, Integer status);

    List<NursingLevelVo> listAll();

    void insertBatch(List<NursingLevel> levels);

    List<NursingLevel> listAllByPlanIds(List<Long> ids);

    @Select("select status from nursing_level where id = #{id}")
    int getStatus(Long id);
}
